﻿namespace JxcLite.Services;

public interface IBillService : IService
{
    Task<PagingResult<BillInfo>> QueryBillsAsync(PagingCriteria criteria);
    Task<BillInfo> GetBillAsync(string id);
    Task<Result> DeleteBillsAsync(List<BillInfo> models);
    Task<Result> UnVerifyBillsAsync(List<BillInfo> infos);
    Task<Result> SaveBillAsync(UploadInfo<BillInfo> info);
}

[Client]
class BillClient(HttpClient http) : ClientBase(http), IBillService
{
    public Task<PagingResult<BillInfo>> QueryBillsAsync(PagingCriteria criteria)
    {
        return Http.QueryAsync<BillInfo>("/Bill/QueryBills", criteria);
    }

    public Task<BillInfo> GetBillAsync(string id)
    {
        return Http.GetAsync<BillInfo>($"/Bill/GetBill?id={id}");
    }

    public Task<Result> DeleteBillsAsync(List<BillInfo> infos)
    {
        return Http.PostAsync("/Bill/DeleteBills", infos);
    }

    public Task<Result> UnVerifyBillsAsync(List<BillInfo> infos)
    {
        return Http.PostAsync("/Bill/UnVerifyBills", infos);
    }

    public Task<Result> SaveBillAsync(UploadInfo<BillInfo> info)
    {
        return Http.PostAsync("/Bill/SaveBill", info);
    }
}